<?php

namespace App\Repositories;

use App\Models\Permission;
use Prettus\Repository\Eloquent\BaseRepository;
use Prettus\Repository\Contracts\RepositoryInterface;

class PermissionRepository extends BaseRepository implements RepositoryInterface
{

    public function model()
    {
        return Permission::class;
    }

    /*
     * 返回所有菜单项
     */
    public function getMenu()
    {
        return $this->model->where('is_menu', 1)->orderBy('sort', 'asc')->orderBy('id', 'asc')->get();
    }

    /*
     * 返回所有权限并排序
     */
    public function getAll()
    {
        return $this->model->orderBy('sort', 'asc')->orderBy('id', 'asc')->get();
    }

}